<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>5.删除节点</title>
</head>

<body>
    <button>删除</button>
    <ul>
        <li>张勇大帅批</li>
        <li>峰哥真牛皮</li>
        <li>我俩好兄弟兮</li>
    </ul>

    <script>
        var btn = document.querySelector('button');
        var ul = document.querySelector('ul');
       
        btn.onclick=function(){
            if(ul.children.length==0){
                btn.disabled=true;
            }else{
                ul.removeChild(ul.children[0]);
            }
           
        }
        
        // node.removeChild(child) 其中node为父节点元素，child为子元素节点
        console.log(ul)

    </script>

</body>

</html>